/**
 * @ Author: luoqi
 * @ Create Time: 2025-02-28 23:00
 * @ Modified by: luoqi
 * @ Modified time: 2025-03-13 22:43
 * @ Description:
 */

#ifndef _FOCD_H
#define _FOCD_H

#include <stdint.h>
#include "../modules/qwave.h"

#ifndef qfp_t
typedef float qfp_t;
#endif

typedef enum {
    FOCD_OFF = 0,
    FOCD_ON
} FocdEna;

typedef enum {
    FOCD_DUMP_OFF = 0,
    FOCD_DUMP_ON
} FocdIsDump;

typedef struct {
    QWaveGen wave;
    FocdEna ena;
    FocdIsDump is_dump;
    int (*dump)(const uint8_t *data, uint32_t len);
} FocDebugger;

typedef int (*DumpFunc)(const uint8_t *data, uint32_t len);

int focd_init(FocDebugger *dbg, qfp_t fs, qfp_t frq, DumpFunc dump);

int focd_ena_set(FocDebugger *dbg, FocdEna ena);

int focd_signal_set(FocDebugger *dbg, QWaveType type);

int focd_amp_set(FocDebugger *dbg, qfp_t amp);

int focd_frq_set(FocDebugger *dbg, qfp_t frq);

int focd_fs_set(FocDebugger *dbg, qfp_t fs);

int focd_signal_output(FocDebugger *dbg, qfp_t *output);

int focd_dump(FocDebugger *dbg, const uint8_t *data, uint32_t len);

#endif
